package club.xinghe.servlet.teacher;

import club.xinghe.biz.ExamBiz;
import club.xinghe.util.JsonServlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/teacher/QRupServlet")
public class QRupServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String estring = request.getParameter("estring");
        int eid = Integer.parseInt(request.getParameter("eid"));
        String ename = request.getParameter("ename");
        String estart = request.getParameter("estart");
        String eend = request.getParameter("eend");
        int etime = Integer.parseInt(request.getParameter("etime"));
        int gid = Integer.parseInt(request.getParameter("gid"));
        ExamBiz examBiz = new ExamBiz();
        int n = examBiz.upExam(estring,eid,ename,estart,eend,etime,gid);
        if (n > 0){
            JsonServlet.getJson(request,response,n);
        }
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req,resp);
    }
}
